// mixin.js
import { computed, ref, defineComponent } from 'vue'
import { useStore } from 'vuex';
import { notification } from 'ant-design-vue';

 
export default function () {
 
        const requestSucc = (res, callback) => {

            const { data,status,code} = res
            if (status == 200) {
                callback(data)
            } else {
                requestFailed(data)
            }
        }

        const requestFailed = (err) => {

            notification['error']({
                message: '错误',
                description: ((err.response || {}).data || err || {}).message || '请求出现错误，请稍后再试',
                duration: 4,
            })
        }
        return {
            requestSucc,
            requestFailed,
            
        }
    
}
 

 